package whf.framework.security.service;

import java.util.List;

import whf.framework.exception.FindException;
import whf.framework.exception.ServiceNotFoundException;
import whf.framework.security.dao.GroupDAO;
import whf.framework.security.entity.Group;
import whf.framework.security.entity.Role;
import whf.framework.security.entity.User;
import whf.framework.util.BeanFactory;

/**
 * @author wanghaifeng
 * @email king@126.com
 * @modify 2006-05-31
 */
public class GroupServiceImp extends whf.framework.service.ServiceImp<Group> implements GroupService {

	private GroupDAO groupDAO;

	/**
	 * @modify wanghaifeng Aug 31, 2006 12:37:28 PM
	 * @param groupDAO
	 */
	public void setGroupDAO(GroupDAO groupDAO) {
		this.groupDAO = groupDAO;
	}

	public static GroupService getGroupService() throws ServiceNotFoundException {
		return (GroupService)BeanFactory.getService(GroupServiceImp.class) ;
	}

	/* (non-Javadoc)
	 * @see whf.framework.auth.service.GroupService#findByUser(whf.framework.auth.entity.User)
	 */
	public List<Group> findByUser(User user) throws FindException {
		return groupDAO.findByUser(user);
	}

	/* (non-Javadoc)
	 * @see whf.framework.auth.service.GroupService#findByRole(whf.framework.auth.entity.Role)
	 */
	public List<Group> findByRole(Role role) throws FindException {
		return groupDAO.findByRole(role);
	}

} 